<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;
use DB;

class Worklinkhtml extends Model
{
    protected $table = 'work_link_html';
    protected $primaryKey = 'id';

    public static function workLinkHtml($kfid)
    {
        return self::where("kfid",$kfid)->first();
    }

    public static function createWorkLinkHtml($kfid,$title,$html)
    {
        return self::insert(["kfid"=>$kfid,"title"=>$title,"html"=>$html,"created_at"=>time()]);
    }

    public static function updateWorkLinkHtml($kfid,$title,$html,$redirect_type,$copyright)
    {
        return self::where("kfid",$kfid)->update(["title"=>$title,"html"=>$html,"redirect_type"=>$redirect_type,"copyright"=>$copyright]);
    }
}
